//
//  NSObject+Extension.m
//  demo
//
//  Created by 周家民 on 2020/8/11.
//  Copyright © 2020 mac. All rights reserved.
//

#import "UIColor+Extension.h"

@implementation UIColor (Extension)

- (UIColor *)setDarkModeColor:(UIColor *)darkModeColor {
    if (@available(iOS 13.0, *)) {
        return [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {
            if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
                return darkModeColor;
            } else {
                return self;
            }
        }];
    } else {
        return self;
    }
}

+ (UIColor *)dgg_ColorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha {
    return [UIColor colorWithRed:red / 255.0 green:green / 255.0 blue:blue / 255.0 alpha:alpha];
}

@end
